package com.mark.mall.admin.platform.dto;

import com.mark.mall.admin.platform.entity.Order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * Created by admin on 2021/3/2 21:17
 */
@Data
@ApiModel("销售单列表")
@NoArgsConstructor
public class OrderDTO {
    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "下单会员")
    private String makeName;

    @ApiModelProperty(value = "销售单编号")
    private String orderno;

    @ApiModelProperty(value = "销售单价格")
    private BigDecimal price;

    @ApiModelProperty(value = "销售单创建时间")
    private LocalDateTime createtime;

    public OrderDTO(Order order) {
        this.id = order.getId();
        this.orderno = !StringUtils.isEmpty(order.getOrderno()) ? order.getOrderno() : "";
        this.price = !StringUtils.isEmpty(order.getPrice()) ? order.getPrice() : new BigDecimal("0.00");
        this.createtime = order.getCreatetime();
    }
}
